package com.atguigu.tingshu.order.interceptor.impl;

import com.atguigu.tingshu.common.constant.SystemConstant;
import com.atguigu.tingshu.order.context.SaveOrderStrategyContext;
import com.atguigu.tingshu.order.interceptor.OrderHandlerInterceptor;
import com.atguigu.tingshu.order.strategy.SaveOrderStrategy;
import com.atguigu.tingshu.vo.order.OrderInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 保存订单任务类 第三个执行
 * @author Petrichor
 */
@Service
@Slf4j
public class SavaOrderOrderHandlerInterceptor implements OrderHandlerInterceptor {

    /**
     * @description: 保存订单任务
     * @author Petrichor
     * @date 2024/1/7 23:22
     * @param orderInfoVo 订单信息
     * @return orderInfoVo 订单信息
     **/
    @Override
    public OrderInfoVo sbumitOrderRequestProcess(OrderInfoVo orderInfoVo) {
        log.info("SavaOrderOrderHandlerInterceptor.....sbumitOrderRequestProcess...方法执行了");
        SaveOrderStrategy saveOrderStrategy = SaveOrderStrategyContext.getSaveOrderStrategy(orderInfoVo.getPayWay());
        return saveOrderStrategy.saveOrder(orderInfoVo);
    }

    @Override
    public int sort() {
        return 3;
    }
}